package com.cxso.example.sdk.http.client;


import com.cxso.example.sdk.http.core.ChoiceClient;

public class ClientManager {

    private final ChoiceClient choiceClient;

    public ClientManager(ChoiceClient choiceClient) {
        this.choiceClient = choiceClient;
    }

    public <T extends Client> T use(Class<T> tClass) {
        try {
            return tClass.getDeclaredConstructor(ChoiceClient.class).newInstance(choiceClient);
        } catch (Exception exception) {
            throw new RuntimeException("选定的服务初始化异常");
        }
    }
}
